package p.ithorns.tools.log;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * 业务日志
 *
 * @author ithorns
 * @version 1.0
 * @date 2021/3/15 14:37
 */
@Getter
@Setter
@Builder
public class BizLog implements Serializable {

    /**
     * 用户
     */
    private String username;

    /**
     * 操作
     */
    private String operation;

    /**
     * 方法
     */
    private String method;

    /**
     * 参数
     */
    private String params;

    /**
     * 执行结果 RET_SUCCESS/FAILURE
     */
    private String result;

    /**
     * 提示信息
     */
    private String msg;

    /**
     * 耗时
     */
    private Long elapsed;

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" <");
        sb.append("Hash=").append(hashCode());
        sb.append(", username=").append(username);
        sb.append(", operation=").append(operation);
        sb.append(", method=").append(method);
        sb.append(", params=").append(params);
        sb.append(", result=").append(result);
        sb.append(", msg=").append(msg);
        sb.append(", elapsed=").append(elapsed);
        sb.append(">");
        return sb.toString();
    }

}